/**
 * @ClassName LC191
 * @Author ykx
 * @Date 2024/3/28 21:41
 * @Version 1.0
 */
public class LC191 {
    public static void main(String[] args) {
        LC191 lc191 = new LC191();
        System.out.println(lc191.hammingWeight(128));
    }

    public int hammingWeight(int n) {
        int count = 0;
        while (n > 0) {
            if (n % 2 != 0) {
                count++;
            }
            n = n / 2;
        }

        return count;
    }
}
